home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0669.ZIP
/
LOGON.PRG
< prev
next >
Wrap
Text File
|
1985-12-30
|
3KB
|
111 lines
* PROGRAM....LOGON.PRG
* AUTHOR.....MIKE COTICCHIO
* NOTES......This program permits logging on to password protected
* system and keeps a record of logon/logoff time
use logon index logon
clear
**** Loop to test whether username is valid ****
store .f. to goodname
do while .not. goodname
clear
store space(15) to username
@ 5,5 say "Username: " get username picture '@!'
read
**** If no username is input, program ends ****
if asc(username) = 32
clear
close database
return
endif
**** Search for username. If no match, give error message ****
**** and loop back to start of routine ****
find &username
if eof()
? chr(7)
@ 10,5 say trim(username)+' is not on file!'
?
?
wait
loop
else
store .t. to goodname
endif
enddo
store trim(password) to password1
**** This section calls decryption routine. Remove if not needed ****
@ 7,5 say 'Standby...'
store space(10) to decrypted
do decrypt with password1,decrypted
store decrypted to password1
@ 7,0 clear
**** End of call to decryption routine ****
store 0 to logtry
store 5 to row
**** Loop to allow three tries at logging on before dumping out ****
do while logtry < 3
row = row+2
@ row,5 say 'Password?'
set color to 0/0
accept to mpassword
set color to 3/0
if upper(mpassword) <> upper(password1)
? chr(7)
logtry = logtry+1
else
exit
endif
enddo
if logtry = 3
@ row+2,5 say "Strike three - you're out!"
?
?
wait
quit
else
@ row+2,5 say 'Logon successful - welcome!'
?
?
endif
select 2
use syslog
append blank
replace name with a->name,date with date()
replace timein with substr(time(),1,5)
? 'User '+trim(name)+' logged on system at '+ timein
close databases
**** time delay loop so you can read the message ****
store 0 to cntr
do while cntr < 20
cntr = cntr+1
enddo
**** At this point, you can call the main program, usually by ****
**** displaying a main menu of options. In order for the logoff ****
**** section to work, the program must exit back to this calling ****
**** program by issuing a RETURN statement in response to an ****
**** option to end the program. The program called below is a ****
**** sample menu ****
do mainmenu
use syslog
go bottom
clear
replace timeout with substr(time(),1,5)
@ 10,5 say 'User '+trim(name)+' logged off system at '+timeout
close databases
return